---
title: Submit Appworx batch job (instance)
summary: Assembles and submits a configured Appworx batch-job request via the SAIF BOF data portal.
status: draft
owner: <owner>
last_reviewed: 2026-08-21
library: SAIF.Services.Appworx
reference_type: package
operation_id: OP-APX-001
trigger: Caller calls SubmitBatchJob() on a constructed clsRequestAppworxJob instance
---

# Submit Appworx batch job (instance)

This operation builds and executes the `submit_appworx_job` stored-procedure call using the properties set on a `clsRequestAppworxJob` instance, and normalizes any failure into a single exception type.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-APX-001 |
| **Trigger** | Caller invokes `SubmitBatchJob()` on a `clsRequestAppworxJob` instance with `ModuleName` (and optionally `Requestor`/`Printer`/`Arg1`–`Arg20`) already set. |
| **Inputs** | `ModuleName`, `Requestor` (default `"APPWORX"`), `Printer` (default `"SYSOUT"`), `Arg1`–`Arg20` |
| **Outputs** | No return value (`NonQuery`); side effect is the Appworx job submission in Oracle; throws `ApplicationException` on failure |
| **Primary components** | `clsRequestAppworxJob.SubmitBatchJob` |
| **Entry point** | `SAIF.Services.Appworx\clsRequestAppworxJob.vb` |

## Steps

1. Build a new `IPortalRequest`/`IDataRequest` pair; set `RequestType = DataRequestType.NonQuery`, `CommandType = CommandType.StoredProcedure`, `SQLStatement = "submit_appworx_job"` ([SQL-APPWORX-001](../sql/SQL-APPWORX-001-submit-appworx-job.md)).
2. Add required parameters `inModule` (30 chars), `inRequestor` (32 chars), `inPrinter` (30 chars).
3. For each of `Arg1`–`Arg20`, if the corresponding `clsSmartString` `IsEmpty` is `False`, add parameter `inArgN` (4000 chars) with the argument's value ([BR-APX-001](../business-rules.md#br-apx-001-optional-arguments-omitted-when-empty), [SQL-APPWORX-001](../sql/SQL-APPWORX-001-submit-appworx-job.md)).
   - If `IsEmpty` is `True`: the corresponding `inArgN` parameter is omitted entirely.
4. Call `DPI.ProcessPortalRequest(PortalRequest)` inside a `Try/Catch`, delegating execution to the `SAIF.BOF.Framework` package's data portal ([SQL-APPWORX-001](../sql/SQL-APPWORX-001-submit-appworx-job.md)).
   - On failure: catch the exception and rethrow as `ApplicationException("Error Submiting Appworx Job " & ex.Message, ex)` ([BR-APX-002](../business-rules.md#br-apx-002-submission-failures-are-wrapped-and-rethrown)).

   > **Origin**: Connection acquisition and command execution against the configured Oracle target are implemented inside `IDataPortalInfo.ProcessPortalRequest`, provided by the referenced `SAIF.BOF.Framework` package. This step's internal logic was not traced from local source and no local operations page documents it**.
5. Clear local `PortalRequest`/`DataRequest` references (`= Nothing`) at the end of the method.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([SubmitBatchJob called]) --> S1[Build IDataRequest: NonQuery, StoredProcedure, submit_appworx_job]
	S1 --> S2[Add required params: inModule, inRequestor, inPrinter]
	S2 --> S3[Add optional inArg1..inArg20 for non-empty ArgN]
	S3 --> S4[Call DPI.ProcessPortalRequest]
	S4 --> D{Exception thrown?}
	D -->|Yes| EndErr([Throw ApplicationException])
	D -->|No| EndOk([Job submitted, references cleared])
```

## Failure and edge-case behavior

- Any exception from `DPI.ProcessPortalRequest` is wrapped as `ApplicationException` with a fixed message prefix (containing a source-level typo, "Submiting") and the original exception preserved as `InnerException` ([BR-APX-002](../business-rules.md#br-apx-002-submission-failures-are-wrapped-and-rethrown)).
- Argument slots that were never set (still empty from `InitArgs()`) are silently omitted from the stored-procedure call rather than sent as empty values ([BR-APX-001](../business-rules.md#br-apx-001-optional-arguments-omitted-when-empty)).

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

## Sources
- `SAIF.Services.Appworx\clsRequestAppworxJob.vb`
